﻿using Abp.Application.Services;
using Abp.Domain.Repositories;
using Abp.Linq.Extensions;
using AbpVueDemo.WeihuDome.FeiyingDataManager.Dto;
using AbpVueDemo.WeihuguanliDemo;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AbpVueDemo.WeihuDome.FeiyingDataManager
{
    public class FeiyongDataService : AsyncCrudAppService<FeiyongData, FeiyongDataInputDto, int, PageFeiyongDataRequestDto, FeiyongDataCreateDto, FeiyongDataUpdateDto>, IFeiyongDataService
    {
        public FeiyongDataService(
       IRepository<FeiyongData, int> repository) : base(repository)
        {

        }
        /// <summary>
        /// 自定义分页条件查询, 需要重写父类的CreateFilteredQuery方法,让其进行自定义条件筛选
        /// </summary>
        /// <param name="input">查询条件</param>
        /// <returns></returns>
        protected override IQueryable<FeiyongData> CreateFilteredQuery(PageFeiyongDataRequestDto input)
        {
            return base.CreateFilteredQuery(input)

               
                   .WhereIf(!string.IsNullOrEmpty(input.funame), c => c.funame.Contains(input.funame))
                  .WhereIf(!string.IsNullOrEmpty(input.chepaihao), c => c.chepaihao.Contains(input.chepaihao))
                   // .WhereIf(input.zhuangtai > 0, c => c.zhuangtai == input.zhuangtai)
                   .WhereIf(input.riqi.HasValue, c => c.riqi == input.riqi);
        }
    }
}
